using UnityEngine;
using System.Collections;

public class Powerups : MonoBehaviour {

    public PlayerPowerups.PowerupNames powerupType;

	// Use this for initialization
	void Start () {
		if (!GlobalState.isRedHero) {
			gameObject.SetActive(false);
		}
		
        switch (powerupType)
        {
            case PlayerPowerups.PowerupNames.HeartBeet:
                renderer.material = Resources.Load("powerupBeetMaterial") as Material;
                break;
            case PlayerPowerups.PowerupNames.HeartSole:
                renderer.material = Resources.Load("powerupSoleMaterial") as Material;
                break;
            case PlayerPowerups.PowerupNames.HeartThrob:
                renderer.material = Resources.Load("powerupThrobMaterial") as Material;
                break;
        }
	}
	
	// Update is called once per frame
	void Update () {
	
	}


    void OnTriggerEnter(Collider other)
    {
        PlayerPowerups pp = other.gameObject.GetComponent<PlayerPowerups>();
        if (pp)
        {
            pp.SetPowerUp(powerupType, 10.0f);
            Destroy(gameObject);
        }
    }
}
